<%= render :partial => "layouts/table_head", :locals => {:title => "Listando deportistas"} %>

<table cellspacing="0" cellpadding="3" style="margin: 5px;">
	<tr>
		<% for column in Deportista.columns %>
			<th><%= column.human_name %></th>
		<% end %>
	</tr>
	<% 
		count_row = 0
	%>
	<% for deportista in @deportistas 
		css_class = "fila_clara"
		
		if count_row % 2 > 0
			css_class = "fila_clara"
		else
			css_class = ""
		end
	%>		
	<tr class="<%= css_class %>">
		<% for column in Deportista.columns
			value_to_show = h( deportista.send(column.name) )
			
			if column.name == "equipo_id" 
				t_equipo = Equipo.find( deportista.send(column.name).to_i )
				value_to_show = t_equipo.nombre
			end
			
			if column.name == "delegacion_id" 
				t_delegacion = Delegacion.find( deportista.send(column.name).to_i )
				value_to_show = t_delegacion.nombre
			end
		%>
			<td ><%= value_to_show %></td>
		<% end %>

		<td><%= link_to_remote image_tag("b_insrow.png" ,  :class => "imagen", :title => "ver"), 
				:url => { :action => 'show', :id => deportista}, 
				:update => 'main' 
			%>
		</td>
		<td>
			<%= link_to_remote 	image_tag("edit.png" ,  :class => "imagen", :title => "editar"), 
				:url => { :action => 'edit', :id => deportista }, 
				:update => 'main' 
			%>
		</td>
		<td>
			<%= link_to_remote 	image_tag("remove.png" ,  :class => "imagen", :title => "eliminar"), 
					:url => { :action => 'destroy', :id => deportista }, 
					:confirm => 'Esta seguro?', 
					:method => :post, 
					:update => 'main' 
			%>
		</td>
	</tr>
	<% 
			count_row = count_row + 1
	%>
	<% end %>
	<tr>
			<td colspan="21" align="right">
				<script>
					new Effect.Highlight('show_notice', {duration: 3} );
				</script>
				<br><br><br><br><br><br>
				<div id="show_notice" >
				<%
					if flash[:notice] == "Logged in successfully"
						flash[:notice] = ""
					end
				%>
					<div ><%= flash[:notice] %></div>
				</div>
			</td>
	</tr>
</table>
	
	<%= link_to_remote 'anterior', :url => { :page => @deportista_pages.current.previous }, :update => 'main' if @deportista_pages.current.previous %>
	<%= link_to_remote 'siguiente', :url => { :page => @deportista_pages.current.next }, :update => 'main' if @deportista_pages.current.next %> 
	<br />
<%= link_to_remote 'a&#241;adir deportista', :url => { :action => 'new'}, :update => 'main' %> | <%= link_to_remote 'Atras', :url => 'jdnbb/home', :update => 'main' %>

<%= render :partial => "layouts/table_foot" %>